package UI;

import java.io.Serializable;
import java.util.Date;

public class PMUI implements Serializable {

    private Date timesent;
    private String message;
    private int sender_id;
    private String sender;
    private String receiver;

    public PMUI() {
    }

    public PMUI(Date timesent, String message, int sender_id, String sender) {
        this.timesent = timesent;
        this.message = message;
        this.sender_id = sender_id;
        this.sender = sender;
    }

    public PMUI(Date timesent, String message, int sender_id, String sender, String receiver) {
        this.timesent = timesent;
        this.message = message;
        this.sender_id = sender_id;
        this.sender = sender;
        this.receiver = receiver;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getSender() {
        return sender;
    }

    public void setSender(String sender) {
        this.sender = sender;
    }

    public int getSender_id() {
        return sender_id;
    }

    public void setSender_id(int sender_id) {
        this.sender_id = sender_id;
    }

    public Date getTimesent() {
        return timesent;
    }

    public void setTimesent(Date timesent) {
        this.timesent = timesent;
    }

    public String getReceiver() {
        return receiver;
    }

    public void setReceiver(String receiver) {
        this.receiver = receiver;
    }

    public String getModifiedDateString() {
        String month = null;
        String hour = null;
        String day = null;
        String minute = null;
        int monthint = timesent.getMonth() + 1;
        int yearint = timesent.getYear() + 1900;
        if (monthint < 10) {
            month = "0" + monthint;
        } else {
            month = "" + monthint;
        }

        if (timesent.getDate() < 10) {
            day = "0" + timesent.getDate();
        } else {
            day = "" + timesent.getDate();
        }


        if (timesent.getHours() < 10) {
            hour = "0" + timesent.getHours();
        } else {
            hour = "" + timesent.getHours();
        }

        if (timesent.getMinutes() < 10) {
            minute = "0" + timesent.getMinutes();
        } else {
            minute = "" + timesent.getMinutes();
        }



        String string = new String("" + yearint + "-" + month + "-" + day + " " + hour + ":" + minute);

        return string;

    }
}
